home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UUPC11QS.ARJ / PRINTERR.C < prev    next >
C/C++ Source or Header  |  1991-11-21  |  3KB  |  65 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    p r i n t e r r . c                                             */
  3. /*                                                                    */
  4. /*    Support routines for UUPC/extended                              */
  5. /*                                                                    */
  6. /*    Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire           */
  7. /*                                                                    */
  8. /*    History:                                                        */
  9. /*       21Nov1991 Break out of lib.c                          ahd    */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. #include <dos.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <time.h>
  17.  
  18. /*--------------------------------------------------------------------*/
  19. /*                    UUPC/extended include files                     */
  20. /*--------------------------------------------------------------------*/
  21.  
  22. #include "lib.h"
  23.  
  24. /*--------------------------------------------------------------------*/
  25. /*    p r i n t e r r                                                 */
  26. /*                                                                    */
  27. /*    Perform a perror() with logging                                 */
  28. /*--------------------------------------------------------------------*/
  29.  
  30. void prterror(const size_t lineno, const char *fname, const char *prefix)
  31. {
  32.    printmsg(0,"File %s(%d) %s: %s",
  33.                fname, lineno, prefix, strerror(errno));
  34.  
  35. #ifdef __TURBOC__
  36.    if (_osmajor >= 3 )
  37.    {
  38.       union REGS regs;
  39.       struct SREGS sregs;
  40.       regs.h.ah = 0x59;       /* Extended error information          */
  41.       regs.x.bx = 0x00;       /* Set up for call                     */
  42.       intdosx(®s, ®s, &sregs);
  43.       printmsg(0,"Extended Error Information: "
  44.             "Number = %d, Class = %d, Action = %d, Locus = %d",
  45.                   (int) regs.x.ax, (int) regs.h.bh,
  46.                   (int) regs.h.bl, (int) regs.h.ch );
  47.  
  48. /*--------------------------------------------------------------------*/
  49. /*               Abort if that is the suggested action                */
  50. /*--------------------------------------------------------------------*/
  51.  
  52.       switch( regs.h.bl )
  53.       {
  54.          case 0x04:
  55.          case 0x05:
  56.                bugout( lineno, fname);
  57.  
  58.          default:
  59.                break;
  60.       } /* switch */
  61.    } /* (_osmajor >= 3 ) */
  62. #endif
  63.  
  64. } /* printerr */
  65.